Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mathjax to properly render mathjax content #31

Merged
merged 2 commits into from
Oct 21, 2024
Merged

Conversation

benoit74
Copy link
Contributor

@benoit74 benoit74 commented Oct 15, 2024

Fix #9

Changes:

  • install MathJax from sources on scraper side (failed to work properly on JS side since we want to include it dynamically)
  • setup MathJax based on libretexts.org configuration / needs
  • add logic to reload MathJax everytime we change page since we need to compute current page front, used to properly number equations / figures / ...
  • reorder processing steps to do "simple and fast" things first
  • adapt CONTRIBUTING.md
  • also add page title to display

@benoit74 benoit74 self-assigned this Oct 15, 2024
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.

Project coverage is 50.72%. Comparing base (ff4240b) to head (2f0a3ef).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
scraper/src/libretexts2zim/processor.py 0.00% 18 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
- Coverage   51.37%   50.72%   -0.65%     
==========================================
  Files           9        9              
  Lines         547      554       +7     
  Branches       61       63       +2     
==========================================
  Hits          281      281              
- Misses        262      269       +7     
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@benoit74 benoit74 force-pushed the add_mathjax branch 5 times, most recently from a038646 to 31bfa94 Compare October 15, 2024 11:42
@benoit74 benoit74 marked this pull request as ready for review October 15, 2024 11:43
@benoit74 benoit74 requested a review from rgaudin October 15, 2024 11:43
Copy link
Member

@rgaudin rgaudin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this a but ugly as updated is completely outside our control and could be called many times.
Given we want to update the macro when page change, it makes more sens to me to tie this to a page change and not a DOM mutation observer.

It works without noticeable impact though so if you feel that's more maintainable this way, it's fine by me.

zimui/src/directives/mathjax.ts Outdated Show resolved Hide resolved
@benoit74 benoit74 merged commit 797edd3 into main Oct 21, 2024
10 checks passed
@benoit74 benoit74 deleted the add_mathjax branch October 21, 2024 09:59
@benoit74
Copy link
Contributor Author

For the record, I've moved from a directive to a service, since this indeed seems more appropriate / simple (and probably more maintainable).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Apply proper MathJax
2 participants